/* 基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 主要内容区域 */
.main-content {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

/* 标签页样式 */
.method-tabs {
    display: flex;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 5px;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    background: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* 文本输入区域 */
#novel-text {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    resize: vertical;
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

#novel-text:focus {
    outline: none;
    border-color: #667eea;
}

.text-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 14px;
    color: #6c757d;
}

/* 文件上传区域 */
.file-upload-area {
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-area:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.upload-placeholder .upload-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.file-types {
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

.file-info {
    margin-top: 20px;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    overflow: hidden;
}

.file-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.btn-remove {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
}

.file-preview {
    max-height: 200px;
    overflow-y: auto;
    padding: 15px;
}

.file-preview pre {
    white-space: pre-wrap;
    font-size: 12px;
    color: #495057;
}

/* 风格选择 */
.style-selection {
    margin: 30px 0;
}

.style-selection h3 {
    margin-bottom: 15px;
    color: #495057;
}

.style-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.style-option input {
    display: none;
}

.style-card {
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.style-option input:checked + .style-card {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.style-preview {
    width: 80px;
    height: 60px;
    margin: 0 auto 10px;
    border-radius: 5px;
    border: 1px solid #dee2e6;
}

.manga-preview { background: linear-gradient(45deg, #ff6b6b, #ee5a24); }
.manhua-preview { background: linear-gradient(45deg, #4834d4, #686de0); }
.webtoon-preview { background: linear-gradient(45deg, #00d2d3, #54a0ff); }
.american-preview { background: linear-gradient(45deg, #f0932b, #eb4d4b); }

/* 生成按钮 */
.generate-section {
    text-align: center;
    margin: 30px 0;
}

.btn-generate {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 200px;
}

.btn-generate:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.btn-generate:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 进度显示 */
.progress-section {
    margin: 40px 0;
}

.progress-container {
    margin-bottom: 30px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e9ecef;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 5px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 14px;
    color: #495057;
}

.progress-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.progress-step {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #e9ecef;
}

.progress-step.completed {
    border-left-color: #28a745;
    background: #f8fff9;
}

.progress-step.processing {
    border-left-color: #007bff;
    background: #f0f8ff;
}

.step-icon {
    font-size: 1.2rem;
    margin-right: 10px;
}

.step-text {
    flex: 1;
    font-weight: 500;
}

.step-status {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    background: #e9ecef;
    color: #495057;
}

.step-status.completed {
    background: #d4edda;
    color: #155724;
}

.step-status.processing {
    background: #cce7ff;
    color: #004085;
}

/* 结果展示 */
.result-section {
    margin-top: 40px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.result-actions {
    display: flex;
    gap: 10px;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-secondary:hover {
    background: #545b62;
}

/* 漫画查看器 */
.comic-viewer {
    border: 1px solid #e9ecef;
    border-radius: 10px;
    padding: 20px;
    background: #f8f9fa;
    min-height: 400px;
}

.comic-page {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.page-title {
    font-weight: 600;
    color: #495057;
}

.page-actions {
    display: flex;
    gap: 10px;
}

.panels-container {
    display: grid;
    gap: 15px;
}

.comic-panel {
    position: relative;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.panel-image {
    width: 100%;
    height: auto;
    display: block;
}

.panel-dialogue {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px;
    border-top: 1px solid #dee2e6;
    font-size: 14px;
    text-align: center;
}

/* 页脚 */
.footer {
    text-align: center;
    margin-top: 40px;
    color: white;
    opacity: 0.8;
}

/* 调试样式 */
.debug-border {
    border: 2px solid red !important;
}

/* 确保按钮样式正确 */
.btn-generate {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-generate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-generate:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 漫画面板样式 */
.comic-panel {
    position: relative;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    margin-bottom: 20px;
}

.panel-image-container {
    width: 100%;
    background: #f8f9fa;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-image {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

/* 对话气泡样式 */
.panel-dialogue {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
}

.dialogue-bubble {
    background: white;
    border: 2px solid #007bff;
    border-radius: 20px;
    padding: 12px 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    max-width: 80%;
}

.dialogue-bubble::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border: 10px solid transparent;
    border-bottom-color: #007bff;
}

.dialogue-text {
    color: #333;
    font-size: 14px;
    line-height: 1.4;
    text-align: center;
}

/* 错误状态样式 */
.image-error {
    text-align: center;
    padding: 20px;
    background: #ffebee;
    border: 1px solid #f44336;
    border-radius: 5px;
    margin: 10px;
}

/* 加载状态 */
.loading-placeholder {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

/* 页面布局改进 */
.comic-page {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e9ecef;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.page-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #495057;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .comic-panel {
        margin-bottom: 15px;
    }
    
    .panel-image-container {
        min-height: 300px;
    }
    
    .dialogue-bubble {
        max-width: 90%;
        padding: 10px 15px;
    }
    
    .dialogue-text {
        font-size: 13px;
    }
}